import time

LEVEL_ERROR = '[Error]'
LEVEL_INFO = '[Info]'
LEVEL_WARN = '[Warning]'
def LOG(level, msg):
    def time_str():
        return time.strftime('%Y-%m-%d %H:%M:%S  ', time.localtime())
    log_msg = time_str() + level + ': ' + str(msg)
    print(log_msg)
    if level == LEVEL_ERROR:
        exit('Error: {}'.format(log_msg))